package com.tomtop.core.utils;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class TestExecl {
	public static void main(String[] args) throws IOException {
		File xls = new File("E:/abc.xlsx");
		ExcelPoi.exPort(xls, "测试的sheet", 1, (index, sheetid) -> {
			if (index >= 1000)
				return null;
			List<Map<String, Object>> list = new ArrayList<>();
			for (int id = 0; id < 9000; id++) {
				list.add(MapUtils.<String, Object>n().a("rowid", index + id).a("id", id).a("name", "username-" + id).a("password", "password-" + id).to());
			}
			return list;
		}, (row, user, index, sheetid) -> {
			ExcelPoi.writeRow(row, 1, user, "rowid", "id", "name", "password");
		});

		ExcelPoi.imPort(xls, 1, (row, rownum, sheetName) -> {
			System.err.println(ExcelPoi.readRow(row, 1, "rowid", "id", "name", "password"));
			System.err.println(ExcelPoi.readCell(row.getCell(0)));;
		});
	}
}
